<script type="text/javascript">
$(document).ready(function(){
	$('#editForm').ajaxForm({
		success:       showResponse
	});
	function showResponse(data){
		$("#editBtn").attr('value','<?php echo $this->translate('edit')?>');
	    subject.setEditMode(0);
        subject.setSubject();
	}
});
</script>
<form action="<?php echo $this->route('save')?>" id="editForm"  method="post">
<input type="hidden"  name="year_semester" value="<?php echo $this->year_semester?>" />
<input type="hidden"  name="classSn" value="<?php echo $this->classSn?>" />
<table>
<thead>
<tr>
<th><?php echo $this->translate('scope')?></th>
<th><?php echo $this->translate('subject name')?></th>
<th><?php echo $this->translate('scored')?></th>
<th><?php echo $this->translate('full')?></th>
<th><?php echo $this->translate('sections')?></th>
<th><?php echo $this->translate('rate')?></th>
<th><?php echo $this->translate('action')?></th></tr>
</thead>
<tbody>
<?php foreach ($this->data as $scope=>$row):?>
<?php $i=0;?>
<?php foreach($row as $val):?>
<tr>
<?php if($i++ == 0):?>
<td rowspan="<?php echo count($row)?>"><?php echo $scope?></td>
<?php endif?>
<td><?php echo $val['name']?></td>
<td>
<?php if ($this->editMode):?>
<input type="checkbox" name="scored[<?php echo $val['sn']?>]" <?php if ($val['scored'] == 'Y'):?>checked="checked"<?php endif?> />
<?php else:?>
<?php if ($val['scored'] == 'Y'):?><img src="<?php echo $this->baseUrl?>/images/ok.png" /><?php endif?>
<?php endif?>
</td>
<td>
<?php if ($this->editMode):?>
<input type="checkbox" name="scored_mode[<?php echo $val['sn']?>]" <?php if ($val['scored_mode'] == 1):?>checked="checked"<?php endif?> />
<?php else:?>
<?php if ($val['scored_mode'] == 1):?><img src="<?php echo $this->baseUrl?>/images/ok.png" /><?php endif?>
<?php endif?>
</td>
<td>
<?php if ($this->editMode):?>
<input type="text" name="sections[<?php echo $val['sn']?>]" value="<?php echo $val['sections']?>" size="2" />
<?php else:?>
<?php echo $val['sections']?>
<?php endif?>
</td>
<td>
<?php if ($this->editMode):?>
<input type="text" name="rate[<?php echo $val['sn']?>]" value="<?php echo $val['rate']?>" size="2" />
<?php else:?>
<?php echo $val['rate']?>
<?php endif?>
</td>
<td>
<img src="<?php echo $this->baseUrl?>/images/edit.png" />
<a href='#' class='deleteBtn' id="del-<?php echo $val['sn']?>"><?php echo $this->translate('delete')?></a>
</td>
</tr>
<?php endforeach;?>

<?php endforeach;?>
</tbody>
</table>
<input type="hidden" name="sameWholeGrade" id="sameWholeGrade" value="0" />
</form>